package com.gongj.shej.service;

import com.gongj.shej.demo.FoodStrategyFactory;
import com.gongj.shej.demo.SimpleFoodFactory;
import com.gongj.shej.demo.StrategyFactory;
import com.gongj.shej.策略模式.Strategy;
import org.springframework.stereotype.Service;

/**
 * @program: shej
 * @description:
 * @author: gongj
 * @Description: TODO
 * @create: 2020-07-23 19:37
 **/
@Service
public class StrategyService {

    //购买
    public void purchase(){
        Strategy creator = StrategyFactory.getInstance().creator(30);
        creator.get(30);
    }
    //购买2
    public void purchase2(Integer money){
        Strategy creator = FoodStrategyFactory.getFoodStrategy(money);
        creator.get(money);
    }

}
